package dictcn.com.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

import dictcn.com.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class Settings extends Activity {//设置界面Activity

	private ListView listView=null;
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.settings);
		
		listView=(ListView)findViewById(R.id.lv_settings);
		
		//显示的数据数组
		String data[]=new String[]{"学习任务管理","词典偏好设置","帐号管理（----进行中）","分享设置（----进行中）","通知设置",
				"通知栏快捷查词","跨软件复制查词","夜间模式","离线扩展包下载","名人推荐","支持海词，推荐给好友（----进行中）",
				"软件推荐","清空缓存","意见反馈","检测更新","新功能介绍","使用帮助","音标说明","版权说明","关于"};
		
		ArrayList<Map<String,String>> listItem=new ArrayList<Map<String,String>>();
		Map<String,String> map;
		for(int i=0;i<data.length;i++){
		  map=new HashMap<String,String>();
		  map.put("item", data[i]);
		  listItem.add(map);
		 }	         
	     SimpleAdapter simpleAdapter=new SimpleAdapter(Settings.this,
	       		listItem,
	       		R.layout.settings_list_item,
	       		new String[]{"item"},
	       		new int[]{R.id.txt_settings_item}
	     );         
	    listView.setAdapter(simpleAdapter);
	    listView.setOnItemClickListener(new OnItemClickListener() {
	    	
	    	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
	    			long arg3) {
	    		// TODO Auto-generated method stub
	    		Intent intent=new Intent();
	    		switch(arg2){
		    		case 3:
		    			intent.setClass(Settings.this, ShareSetting.class);
		    			startActivity(intent);
		    			break;
		    		case 2:
		    			intent.setClass(Settings.this, AccoutSetting.class);
		    			startActivity(intent);
		    			break;
		    		case 10:
		    			intent.setClass(Settings.this, ShareSend.class);
		    			startActivity(intent);
		    			break;
	    		}
	    		
	    	}
	    });
	}
}



